package com.fenghuajueli.module_home.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.fenghuajueli.module_home.activity.HomeVideoListActivity
import com.fenghuajueli.module_home.databinding.FragmentCourseBinding
import com.fenghuajueli.module_home.utils.startPlayVideo


class HomeFragment : Fragment() {

    lateinit var binding: FragmentCourseBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        binding = FragmentCourseBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.apply {
            //textView3.updateLayoutParams<ViewGroup.MarginLayoutParams> { topMargin += MyStatusBarUtils.getStatusBarHeight(requireContext()) }
            ivJcyy.setOnClickListener { start("基础英语") }
            ivYyks.setOnClickListener { start("英语考试") }
            tvKyttlMore.setOnClickListener { start("口语练习") }
            tvZcyyMore.setOnClickListener { start("职场英语") }
            tvKyttl1.setOnClickListener { startPlayVideo("bilibili_BV1Kw411d7fv",3) }
            tvKyttl2.setOnClickListener { startPlayVideo("bilibili_BV1wb411z7vt",3) }
            tvKyttl3.setOnClickListener { startPlayVideo("bilibili_BV1fU4y1c7DL",3) }
            clZcyy.setOnClickListener { startPlayVideo("bilibili_BV1uM4y1V7Pn",3) }
        }

    }

    private fun start(s:String){
        HomeVideoListActivity.start(requireActivity(),"课程",s)
    }
}